
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>9.2 预分区 · 大数据 bigdata_hbase_atguigu 课堂笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content=" 李振超">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism-solarizedlight.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-change_girls/girls.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="93-rowkey-she-ji.html" />
    
    
    <link rel="prev" href="91-gao-ke-yong.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.atguigu.com/" target="_blank" class="custom-link">联系我们</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    第 1 章 Hbase 简介
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="../11-shi-yao-shi-hbase.html">
            
                <a href="../11-shi-yao-shi-hbase.html">
            
                    
                    1.1 Hbase 概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="../12-hbase-te-dian.html">
            
                <a href="../12-hbase-te-dian.html">
            
                    
                    1.2 Hbase 特点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3" data-path="../13-hbase-jia-gou.html">
            
                <a href="../13-hbase-jia-gou.html">
            
                    
                    1.3 Hbase 架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.4" data-path="../14-hbase-zhong-de-ge-ge-zu-jian.html">
            
                <a href="../14-hbase-zhong-de-ge-ge-zu-jian.html">
            
                    
                    1.4 Hbase 中的各个组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.4.1" data-path="../14-hbase-zhong-de-ge-ge-zu-jian/141-regionserver.html">
            
                <a href="../14-hbase-zhong-de-ge-ge-zu-jian/141-regionserver.html">
            
                    
                    1.4.1 RegionServer 是什么
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.4.2" data-path="../14-hbase-zhong-de-ge-ge-zu-jian/142-region-shi-shi-yao.html">
            
                <a href="../14-hbase-zhong-de-ge-ge-zu-jian/142-region-shi-shi-yao.html">
            
                    
                    1.4.2 Region 是什么
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.4.3" data-path="../14-hbase-zhong-de-ge-ge-zu-jian/143-master-shi-shi-yao.html">
            
                <a href="../14-hbase-zhong-de-ge-ge-zu-jian/143-master-shi-shi-yao.html">
            
                    
                    1.4.3 Master 是什么
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.1.5" data-path="../14-hbase-cun-chu-de-yi-xie-gai-nian.html">
            
                <a href="../14-hbase-cun-chu-de-yi-xie-gai-nian.html">
            
                    
                    1.5 Hbase 存储的一些概念
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.5.1" data-path="../14-hbase-cun-chu-de-yi-xie-gai-nian/141-xing-952e28-row-key.html">
            
                <a href="../14-hbase-cun-chu-de-yi-xie-gai-nian/141-xing-952e28-row-key.html">
            
                    
                    1.5.1 行键(row key)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.5.2" data-path="../14-hbase-cun-chu-de-yi-xie-gai-nian/142-lie-zu-he-lie.html">
            
                <a href="../14-hbase-cun-chu-de-yi-xie-gai-nian/142-lie-zu-he-lie.html">
            
                    
                    1.5.2 列族和列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.5.3" data-path="../14-hbase-cun-chu-de-yi-xie-gai-nian/143-dan-yuan-683c28-cell.html">
            
                <a href="../14-hbase-cun-chu-de-yi-xie-gai-nian/143-dan-yuan-683c28-cell.html">
            
                    
                    1.5.3 单元格(Cell)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.5.4" data-path="../14-hbase-cun-chu-de-yi-xie-gai-nian/144-region-he-xing-de-guan-xi.html">
            
                <a href="../14-hbase-cun-chu-de-yi-xie-gai-nian/144-region-he-xing-de-guan-xi.html">
            
                    
                    1.5.4 Region 和 行的关系
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.1.6" data-path="../16-hbase-he-guan-xi-xing-shu-ju-ku-de-dui-bi.html">
            
                <a href="../16-hbase-he-guan-xi-xing-shu-ju-ku-de-dui-bi.html">
            
                    
                    1.6 Hbase 和关系型数据库的对比
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter1.html">
            
                <a href="../chapter1.html">
            
                    
                    第 2 章 Hbase 部署和基本配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../chapter1/21-zhun-bei-gong-zuo.html">
            
                <a href="../chapter1/21-zhun-bei-gong-zuo.html">
            
                    
                    2.1 准备工作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../chapter1/22-pei-zhi-hbase.html">
            
                <a href="../chapter1/22-pei-zhi-hbase.html">
            
                    
                    2.2 配置 Hbase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../chapter1/23-qi-dong-hbase.html">
            
                <a href="../chapter1/23-qi-dong-hbase.html">
            
                    
                    2.3 启动 Hbase
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../di-3-zhang-hbase-shell-cao-zuo.html">
            
                <a href="../di-3-zhang-hbase-shell-cao-zuo.html">
            
                    
                    第 3 章 Hbase Shell 操作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../di-3-zhang-hbase-shell-cao-zuo/31-ji-ben-cao-zuo.html">
            
                <a href="../di-3-zhang-hbase-shell-cao-zuo/31-ji-ben-cao-zuo.html">
            
                    
                    3.1 基本操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../di-3-zhang-hbase-shell-cao-zuo/32-biao-de-cao-zuo.html">
            
                <a href="../di-3-zhang-hbase-shell-cao-zuo/32-biao-de-cao-zuo.html">
            
                    
                    3.2 表的操作
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../di-4-zhang-hbase-shu-ju-jie-gou.html">
            
                <a href="../di-4-zhang-hbase-shu-ju-jie-gou.html">
            
                    
                    第 4 章 Hbase 数据模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../di-5-zhang-hbase-nei-bu-yuan-li.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li.html">
            
                    
                    第 5 章 Hbase 内部原理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../di-5-zhang-hbase-nei-bu-yuan-li/51-hbase-shi-ru-he-cun-chu-shu-ju-de.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li/51-hbase-shi-ru-he-cun-chu-shu-ju-de.html">
            
                    
                    5.1 Hbase 是如何存储数据的
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1.1" data-path="../di-5-zhang-hbase-nei-bu-yuan-li/51-hbase-shi-ru-he-cun-chu-shu-ju-de/511-walyu-xie-ri-5fd729.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li/51-hbase-shi-ru-he-cun-chu-shu-ju-de/511-walyu-xie-ri-5fd729.html">
            
                    
                    5.1.1 WAL(预写日志)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.2" data-path="../di-5-zhang-hbase-nei-bu-yuan-li/51-hbase-shi-ru-he-cun-chu-shu-ju-de/912-region-he-store.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li/51-hbase-shi-ru-he-cun-chu-shu-ju-de/912-region-he-store.html">
            
                    
                    5.1.2 Region
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.1.3" data-path="../di-5-zhang-hbase-nei-bu-yuan-li/51-hbase-shi-ru-he-cun-chu-shu-ju-de/913-store.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li/51-hbase-shi-ru-he-cun-chu-shu-ju-de/913-store.html">
            
                    
                    5.1.3 Store
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../di-5-zhang-hbase-nei-bu-yuan-li/52-shu-ju-de-xie-ru-liu-cheng.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li/52-shu-ju-de-xie-ru-liu-cheng.html">
            
                    
                    5.2 数据的写入流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../di-5-zhang-hbase-nei-bu-yuan-li/53-shu-ju-de-du-qu-liu-cheng.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li/53-shu-ju-de-du-qu-liu-cheng.html">
            
                    
                    5.3 数据的读取流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../di-5-zhang-hbase-nei-bu-yuan-li/54-shu-ju-de-flush-guo-cheng.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li/54-shu-ju-de-flush-guo-cheng.html">
            
                    
                    5.4 数据的 Flush 过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../di-5-zhang-hbase-nei-bu-yuan-li/55-shu-ju-de-he-bing-guo-cheng.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li/55-shu-ju-de-he-bing-guo-cheng.html">
            
                    
                    5.5 数据的合并过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../di-5-zhang-hbase-nei-bu-yuan-li/56-region-chai-fen.html">
            
                <a href="../di-5-zhang-hbase-nei-bu-yuan-li/56-region-chai-fen.html">
            
                    
                    5.6 Region 拆分
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../di-6-zhang-hbase-java-api-cao-zuo.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo.html">
            
                    
                    第 6 章 Hbase Java API 操作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../di-6-zhang-hbase-java-api-cao-zuo/61-huo-qu-configuration-dui-xiang.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo/61-huo-qu-configuration-dui-xiang.html">
            
                    
                    6.1 获取 Configuration 对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../di-6-zhang-hbase-java-api-cao-zuo/62-pan-duan-biao-shi-fou-cun-zai.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo/62-pan-duan-biao-shi-fou-cun-zai.html">
            
                    
                    6.2 判断表是否存在
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../di-6-zhang-hbase-java-api-cao-zuo/63-chuang-jian-biao.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo/63-chuang-jian-biao.html">
            
                    
                    6.3 创建表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../di-6-zhang-hbase-java-api-cao-zuo/64-shan-chu-biao.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo/64-shan-chu-biao.html">
            
                    
                    6.4 删除表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../di-6-zhang-hbase-java-api-cao-zuo/65-xiang-biao-zhong-cha-ru-shu-ju.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo/65-xiang-biao-zhong-cha-ru-shu-ju.html">
            
                    
                    6.5 向表中插入数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../di-6-zhang-hbase-java-api-cao-zuo/66-shan-chu-duo-xing-shu-ju.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo/66-shan-chu-duo-xing-shu-ju.html">
            
                    
                    6.6 删除多行数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../di-6-zhang-hbase-java-api-cao-zuo/67-huo-qu-biao-zhong-de-suo-you-shu-ju.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo/67-huo-qu-biao-zhong-de-suo-you-shu-ju.html">
            
                    
                    6.7 获取表中的所有数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../di-6-zhang-hbase-java-api-cao-zuo/68-huo-qu-mou-yi-xing-shu-ju.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo/68-huo-qu-mou-yi-xing-shu-ju.html">
            
                    
                    6.8 获取某一行数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../di-6-zhang-hbase-java-api-cao-zuo/69-huo-qu-mou-yi-xing-zhi-ding-lie-de-shu-ju.html">
            
                <a href="../di-6-zhang-hbase-java-api-cao-zuo/69-huo-qu-mou-yi-xing-zhi-ding-lie-de-shu-ju.html">
            
                    
                    6.9 获取某一行指定列的数据
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../di-7-zhang-hbase-hemapreduce-jie-he.html">
            
                <a href="../di-7-zhang-hbase-hemapreduce-jie-he.html">
            
                    
                    第 7 章 Hbase 和 MapReduce 结合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../di-7-zhang-hbase-hemapreduce-jie-he/71-kuai-su-ru-men.html">
            
                <a href="../di-7-zhang-hbase-hemapreduce-jie-he/71-kuai-su-ru-men.html">
            
                    
                    7.1 快速入门1:统计表中数据的行数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../di-7-zhang-hbase-hemapreduce-jie-he/72-kuai-su-ru-men-2-shi-yong-mapreduce-jiang-ben-di-shu-ju-dao-ru-de-hbase.html">
            
                <a href="../di-7-zhang-hbase-hemapreduce-jie-he/72-kuai-su-ru-men-2-shi-yong-mapreduce-jiang-ben-di-shu-ju-dao-ru-de-hbase.html">
            
                    
                    7.2 快速入门2:使用 MapReduce 将本地数据导入的 HBase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../di-7-zhang-hbase-hemapreduce-jie-he/72-zi-ding-yi-hbase-mapreduce.html">
            
                <a href="../di-7-zhang-hbase-hemapreduce-jie-he/72-zi-ding-yi-hbase-mapreduce.html">
            
                    
                    7.3 自定义 HBase-MapReduce 之一
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../di-7-zhang-hbase-hemapreduce-jie-he/74-zi-ding-yi-hbase-mapreduce-zhi-er.html">
            
                <a href="../di-7-zhang-hbase-hemapreduce-jie-he/74-zi-ding-yi-hbase-mapreduce-zhi-er.html">
            
                    
                    7.4 自定义 HBase-MapReduce 之二
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../di-7-zhang-hbase-you-hua.html">
            
                <a href="../di-7-zhang-hbase-you-hua.html">
            
                    
                    第 8 章 Hbase 和 Hive 结合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../di-7-zhang-hbase-you-hua/81-hive-he-hbase-de-bi-jiao.html">
            
                <a href="../di-7-zhang-hbase-you-hua/81-hive-he-hbase-de-bi-jiao.html">
            
                    
                    8.1 Hive 和 HBase 的比较
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../di-7-zhang-hbase-you-hua/82-hive-he-hbase-de-zheng-he.html">
            
                <a href="../di-7-zhang-hbase-you-hua/82-hive-he-hbase-de-zheng-he.html">
            
                    
                    8.2 Hive 和 HBase 整合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.2.1" data-path="../di-7-zhang-hbase-you-hua/82-hive-he-hbase-de-zheng-he/821-pei-zhi.html">
            
                <a href="../di-7-zhang-hbase-you-hua/82-hive-he-hbase-de-zheng-he/821-pei-zhi.html">
            
                    
                    8.2.1 配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2.2" data-path="../di-7-zhang-hbase-you-hua/82-hive-he-hbase-de-zheng-he/822-an-li-1.html">
            
                <a href="../di-7-zhang-hbase-you-hua/82-hive-he-hbase-de-zheng-he/822-an-li-1.html">
            
                    
                    8.2.2 案例1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2.3" data-path="../di-7-zhang-hbase-you-hua/82-hive-he-hbase-de-zheng-he/823-an-li-2.html">
            
                <a href="../di-7-zhang-hbase-you-hua/82-hive-he-hbase-de-zheng-he/823-an-li-2.html">
            
                    
                    8.2.3 案例2
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../di-9-zhang-hbase-you-hua.html">
            
                <a href="../di-9-zhang-hbase-you-hua.html">
            
                    
                    第 9 章 HBase 优化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="91-gao-ke-yong.html">
            
                <a href="91-gao-ke-yong.html">
            
                    
                    9.1 高可用
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.9.2" data-path="92-yu-fen-qu.html">
            
                <a href="92-yu-fen-qu.html">
            
                    
                    9.2 预分区
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="93-rowkey-she-ji.html">
            
                <a href="93-rowkey-she-ji.html">
            
                    
                    9.3 RowKey 设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="94-nei-cun-you-hua.html">
            
                <a href="94-nei-cun-you-hua.html">
            
                    
                    9.4 内存优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="95-ji-chu-you-hua.html">
            
                <a href="95-ji-chu-you-hua.html">
            
                    
                    9.5 基础优化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo.html">
            
                <a href="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo.html">
            
                    
                    第 10 章 HBase 实战之谷粒微博
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo/101-biao-jie-gou.html">
            
                <a href="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo/101-biao-jie-gou.html">
            
                    
                    10.1 表结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo/102-weiboconstant-lei.html">
            
                <a href="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo/102-weiboconstant-lei.html">
            
                    
                    10.2 WeiboConstant 类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo/103-weiutil-lei.html">
            
                <a href="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo/103-weiutil-lei.html">
            
                    
                    10.3 WeiUtil 类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo/104-weibo-lei.html">
            
                <a href="../di-10-zhang-hbase-shi-zhan-zhi-gu-li-wei-bo/104-weibo-lei.html">
            
                    
                    10.4 Weibo 类
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >9.2 预分区</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="92-&#x9884;&#x5206;&#x533A;">9.2 &#x9884;&#x5206;&#x533A;</h1>
<h2 id="921-region-&#x4E3A;&#x4EC0;&#x4E48;&#x8981;&#x62C6;&#x5206;">9.2.1 Region &#x4E3A;&#x4EC0;&#x4E48;&#x8981;&#x62C6;&#x5206;</h2>
<p>&#x4E00;&#x4E2A;Region&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x8868;&#x7684;&#x4E00;&#x6BB5; Rowkey &#x7684;&#x6570;&#x636E;&#x96C6;&#x5408;&#x3002;&#x5F53; Region &#x592A;&#x5927;&#x7684;&#x65F6;&#x5019;HBase &#x4F1A;&#x62C6;&#x5206;&#x5B83;&#x3002;</p>
<p><strong>&#x4E3A;&#x4EC0;&#x4E48;&#x8981;&#x62C6;&#x5206;&#x5462;?</strong></p>
<p>&#x56E0;&#x4E3A;&#x5F53;&#x67D0;&#x4E2A; Region &#x592A;&#x5927;&#x7684;&#x65F6;&#x5019;&#x8BFB;&#x53D6;&#x6548;&#x7387;&#x592A;&#x4F4E;&#x4E86;&#x3002;</p>
<p>&#x5927;&#x5BB6;&#x53EF;&#x4EE5;&#x60F3;&#x60F3;&#x6211;&#x4EEC; &#x4E3A;&#x4EC0;&#x4E48;&#x4ECE; MySQL&#x3001;Oracle &#x8F6C;&#x79FB;&#x5230; NoSQL &#x6765;&#xFF1F;</p>
<p>&#x6700;&#x6839;&#x672C;&#x7684;&#x539F;&#x56E0;&#x5C31;&#x662F;&#x8FD9;&#x4E9B;&#x5173;&#x7CFB;&#x578B;&#x6570;&#x636E;&#x5E93;&#x628A;&#x6570;&#x636E;&#x653E;&#x5230;&#x4E00;&#x4E2A;&#x5730;&#x65B9;&#xFF0C;&#x67E5;&#x8BE2;&#x7684;&#x672C;&#x8D28;&#x5176;&#x5B9E;&#x4E5F;&#x5C31;&#x662F;&#x904D;&#x5386; key&#xFF1B;</p>
<p>&#x800C;&#x5F53;&#x6570;&#x636E;&#x589E;&#x5927;&#x5230;&#x4E0A;&#x4EBF;&#x7684;&#x65F6;&#x5019;&#x540C;&#x4E00;&#x4E2A;&#x78C1;&#x76D8;&#x5DF2;&#x7ECF;&#x65E0;&#x6CD5;&#x5E94;&#x4ED8;&#x8FD9;&#x4E9B;&#x6570;&#x636E;&#x7684;&#x8BFB;&#x53D6;&#x4E86;&#xFF0C;&#x56E0;&#x4E3A;&#x904D;&#x5386;&#x4E00;&#x904D;&#x6570;&#x636E;&#x7684;&#x65F6;&#x95F4;&#x5B9E;&#x5728;&#x592A;&#x957F;&#x4E86;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x7528; NoSQL &#x7684;&#x7406;&#x7531;&#x5C31;&#x662F;&#x5176;&#x80FD;&#x628A;&#x5927;&#x6570;&#x636E;&#x5206;&#x62C6;&#x5230;&#x4E0D;&#x540C;&#x7684;&#x673A;&#x5668;&#x4E0A;&#xFF0C;&#x7136;&#x540E;&#x5C31;&#x50CF;&#x67E5;&#x8BE2;&#x4E00;&#x4E2A;&#x5B8C;&#x6574;&#x7684;&#x6570;&#x636E;&#x4E00;&#x6837;&#x67E5;&#x8BE2;&#x4ED6;&#x4EEC;&#x3002; </p>
<p>&#x4F46;&#x662F;&#x5F53;&#x4F60;&#x7684; Region &#x592A;&#x5927;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x6B64;&#x65F6;&#x8FD9;&#x4E2A; Region &#x4E00;&#x6837;&#x4F1A;&#x9047;&#x5230;&#x8DDF;&#x4F20;&#x7EDF;&#x5173;&#x7CFB; &#x578B;&#x6570;&#x636E;&#x5E93;&#x4E00;&#x6837;&#x7684;&#x95EE;&#x9898;&#xFF0C;&#x6240;&#x4EE5; HBase &#x4F1A;&#x62C6;&#x5206; Region&#x3002;</p>
<p>&#x8FD9;&#x4E5F;&#x662F; HBase &#x7684;&#x4E00;&#x4E2A;&#x4F18;&#x70B9;&#xFF0C;&#x6709;&#x4E9B;&#x4EBA;&#x4F1A;&#x4ECB;&#x7ECD; HBase &#x4E3A;&#x201C;&#x4E00;&#x4E2A;&#x4F1A;&#x81EA;&#x52A8;&#x5206;&#x7247;&#x7684;&#x6570;&#x636E;&#x5E93;&#x201D;&#x3002;</p>
<my>Region &#x7684;&#x62C6;&#x5206;&#x5206;&#x4E3A;&#x81EA;&#x52A8;&#x62C6;&#x5206;&#x548C;&#x624B;&#x52A8;&#x62C6;&#x5206;&#x3002;</my>

<hr>
<h2 id="922-&#x81EA;&#x52A8;&#x62C6;&#x5206;">9.2.2 &#x81EA;&#x52A8;&#x62C6;&#x5206;</h2>
<p>&#x81EA;&#x52A8;&#x62C6;&#x5206;&#x91C7;&#x7528;&#x4E0D;&#x540C;&#x7684;&#x7B56;&#x7565;.</p>
<p>0.94 &#x7248;&#x672C;&#x4E4B;&#x524D;&#x91C7;&#x7528;&#x7684;&#x662F; <code>ConstantSizeRegionSplitPolicy</code> &#x7B56;&#x7565;&#x3002;</p>
<p>&#x8FD9;&#x4E2A;&#x7B56;&#x7565;&#x975E;&#x5E38;&#x7B80;&#x5355;&#xFF0C;&#x4ECE;&#x540D;&#x5B57;&#x4E0A;&#x5C31;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x8FD9;&#x4E2A;&#x7B56; &#x7565;&#x5C31;&#x662F;&#x6309;&#x7167;&#x56FA;&#x5B9A;&#x5927;&#x5C0F;&#x6765;&#x62C6;&#x5206;Region&#x3002;&#x5B83;&#x552F;&#x4E00;&#x7528;&#x5230;&#x7684;&#x53C2;&#x6570;&#x662F;&#xFF1A; <code>hbase.hregion.max.filesize</code>, &#x9ED8;&#x8BA4;&#x503C;&#x662F; 10G, &#x4E5F;&#x5C31;&#x662F;&#x5F53; Region &#x7684;&#x5927;&#x5C0F;&#x8FBE;&#x5230; 10G &#x7684;&#x65F6;&#x5019;, &#x4F1A;&#x81EA;&#x52A8;&#x62C6;&#x5206;&#x6210;&#x4E24;&#x4E2A; Region.  </p>
<p>0.94 &#x7248;&#x672C;&#x4E4B;&#x540E;&#x5C31;&#x4E0D;&#x7528;&#x8FD9;&#x79CD;&#x7B56;&#x7565;&#x4E86;.</p>
<hr>
<p>0.94 &#x7248;&#x672C;&#x4E4B;&#x540E;&#xFF0C;&#x6709;&#x4E86; <code>IncreasingToUpperBoundRegionSplitPolicy</code> &#x7B56;&#x7565;&#x3002;&#x5E76;&#x4E14;&#x9ED8;&#x8BA4;&#x4F7F;&#x7528;&#x7684;&#x8FD9;&#x79CD;&#x7B56;&#x7565;.</p>
<p>&#x8FD9;&#x79CD;&#x7B56;&#x7565;&#x4ECE;&#x540D;&#x5B57;&#x4E0A;&#x5C31;&#x53EF;&#x4EE5;&#x770B;&#x51FA;&#x662F;&#x9650;&#x5236;&#x4E0D;&#x65AD;&#x589E;&#x957F;&#x7684;&#x6587;&#x4EF6;&#x5C3A;&#x5BF8;&#x7684;&#x7B56;&#x7565;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x4EE5;&#x524D;&#x4F7F;&#x7528;&#x4F20;&#x7EDF;&#x5173;&#x7CFB;&#x578B;&#x6570;&#x636E;&#x5E93;&#x7684;&#x65F6;&#x5019;&#x6216;&#x8BB8;&#x6709;&#x8FD9;&#x6837;&#x7684;&#x7ECF;&#x9A8C;&#xFF0C;&#x6709;&#x7684;&#x6570;&#x636E;&#x5E93;&#x7684;&#x6587;&#x4EF6;&#x589E;&#x957F;&#x662F;&#x7FFB;&#x500D;&#x589E;&#x957F;&#x7684;&#xFF0C;&#x6BD4;&#x5982;&#x7B2C;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x662F;64MB&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x5C31;&#x662F; 128MB&#xFF0C;&#x7B2C;&#x4E09;&#x4E2A;&#x5C31;&#x662F;256MB&#x3002;</p>
<p>HBase &#x8FD9;&#x79CD;&#x7B56;&#x7565;&#x5C31;&#x662F;&#x6A21;&#x4EFF;&#x6B64;&#x7C7B;&#x60C5;&#x51B5;&#x6765;&#x5B9E;&#x73B0;&#x7684;&#x3002;</p>
<p>&#x6587;&#x4EF6;&#x5C3A;&#x5BF8;&#x9650;&#x5236;&#x662F;&#x52A8;&#x6001;&#x7684;&#xFF0C;&#x4F9D;&#x8D56;&#x4EE5;&#x4E0B;&#x516C;&#x5F0F;&#x6765;&#x8BA1;&#x7B97;&#xFF1A;</p>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1542329453.png-atguiguText" alt=""></p>
<blockquote>
<h4 id="&#x8BF4;&#x660E;"><em>&#x8BF4;&#x660E;:</em></h4>
</blockquote>
<ul>
<li><p><code>tableRegionCount</code>&#xFF1A;&#x8868;&#x5728;&#x8FD9;&#x4E2A; RegionServer &#x4E0A;&#x8FD9;&#x4E2A;&#x8868;&#x6240;&#x62E5;&#x6709;&#x7684; Region &#x6570;&#x91CF;&#x603B;&#x548C;&#x3002; </p>
</li>
<li><p><code>initialSize</code>&#xFF1A;&#x5982;&#x679C;&#x4F60;&#x5B9A;&#x4E49;&#x4E86; <code>hbase.increasing.policy.initial.size</code>&#xFF0C;&#x5219;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#x6570;&#x503C;&#xFF1B;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5B9A;&#x4E49;&#xFF0C;&#x5C31;&#x7528; memstore &#x7684;&#x5237;&#x5199;&#x5927;&#x5C0F;&#x7684;2&#x500D;&#xFF0C;&#x5373; <code>hbase.hregion.memstore.flush.size * 2&#x3002;</code> </p>
</li>
<li><p><code>defaultRegionMaxFileSize</code>&#xFF1A;<code>ConstantSizeRegionSplitPolicy</code> &#x6240;&#x7528;&#x5230;&#x7684;<code>hbase.hregion.max.filesize</code>&#xFF0C;&#x5373; Region &#x6700;&#x5927;&#x5927;&#x5C0F;&#x3002; </p>
</li>
<li><p><code>Math.min</code>&#xFF1A;&#x53D6;&#x8FD9;&#x4E24;&#x4E2A;&#x6570;&#x503C;&#x7684;&#x6700;&#x5C0F;&#x503C;&#x3002;</p>
</li>
</ul>
<hr>
<p>&#x5047;&#x5982;<code>hbase.hregion.memstore.flush.size</code>&#x5B9A;&#x4E49;&#x4E3A;128MB&#xFF0C;&#x90A3;&#x4E48;&#x6587;&#x4EF6; &#x5C3A;&#x5BF8;&#x7684;&#x4E0A;&#x9650;&#x589E;&#x957F;&#x5C06;&#x662F;&#x8FD9;&#x6837;&#xFF1A;</p>
<p>&#xFF08;1&#xFF09;&#x521A;&#x5F00;&#x59CB;&#x53EA;&#x6709; 1 &#x4E2A;&#x6587;&#x4EF6;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4E0A;&#x9650;&#x662F;<code>256MB</code>&#xFF0C;&#x56E0;&#x4E3A;<code>1^3 * 128*2 = 256MB</code>&#x3002;</p>
<p>&#xFF08;2&#xFF09;&#x5F53;&#x6709; 2 &#x4E2A;&#x6587;&#x4EF6;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4E0A;&#x9650;&#x662F;<code>2GB</code>&#xFF0C;&#x56E0;&#x4E3A;<code>2^3 * 128 * 2 = 2048MB</code>&#x3002;</p>
<p>&#xFF08;3&#xFF09;&#x5F53;&#x6709; 3 &#x4E2A;&#x6587;&#x4EF6;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4E0A;&#x9650;&#x662F;<code>6.75GB</code>&#xFF0C;&#x56E0;&#x4E3A;<code>3^3 * 128 * 2 = 6912MB</code>&#x3002;</p>
<p>&#xFF08;4&#xFF09;&#x4EE5;&#x6B64;&#x7C7B;&#x63A8;&#xFF0C;&#x76F4;&#x5230;&#x8BA1;&#x7B97;&#x51FA;&#x6765;&#x7684;&#x4E0A;&#x9650;&#x8FBE;&#x5230; <code>hbase.hregion.max.filesize</code> region &#x6240;&#x5B9A;&#x4E49;&#x7684;10GB&#x3002;</p>
<p>&#x8FD8;&#x6709;&#x4E00;&#x4E9B;&#x5176;&#x4ED6;&#x7684;&#x5206;&#x533A;&#x7B56;&#x7565;, &#x5728;&#x8FD9;&#x91CC;&#x4E0D;&#x505A;&#x4ECB;&#x7ECD;.</p>
<hr>
<h2 id="922-&#x9884;&#x5206;&#x533A;">9.2.2 &#x9884;&#x5206;&#x533A;</h2>
<p>&#x6BCF;&#x4E00;&#x4E2A; region &#x7EF4;&#x62A4;&#x7740; startRow &#x4E0E; endRowKey&#xFF0C;&#x5982;&#x679C;&#x52A0;&#x5165;&#x7684;&#x6570;&#x636E;&#x7B26;&#x5408;&#x67D0;&#x4E2A;region &#x7EF4;&#x62A4;&#x7684; rowKey &#x8303;&#x56F4;&#xFF0C;&#x5219;&#x8BE5;&#x6570;&#x636E;&#x4EA4;&#x7ED9;&#x8FD9;&#x4E2A; region &#x7EF4;&#x62A4;&#x3002;</p>
<p>&#x90A3;&#x4E48;&#x4F9D;&#x7167;&#x8FD9;&#x4E2A;&#x539F;&#x5219;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5C06;&#x6570;&#x636E;&#x6240;&#x8981;&#x6295;&#x653E;&#x7684;&#x5206;&#x533A;&#x63D0;&#x524D;&#x5927;&#x81F4;&#x7684;&#x89C4;&#x5212;&#x597D;&#xFF0C;&#x4EE5;&#x63D0;&#x9AD8;HBase &#x6027;&#x80FD;&#x3002;</p>
<p>&#x6709;&#x51E0;&#x79CD;&#x9884;&#x5206;&#x533A;&#x7684;&#x65B9;&#x5F0F;:</p>
<h3 id="1-&#x624B;&#x52A8;&#x8BBE;&#x5B9A;&#x5206;&#x533A;&#x70B9;">1. &#x624B;&#x52A8;&#x8BBE;&#x5B9A;&#x5206;&#x533A;&#x70B9;</h3>
<pre class="language-"><code class="lang-sql"><span class="token keyword">create</span> <span class="token string">&apos;staff1&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;info&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;partition1&apos;</span><span class="token punctuation">,</span>SPLITS <span class="token operator">=</span><span class="token operator">&gt;</span><span class="token punctuation">[</span><span class="token string">&apos;1000&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;2000&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;3000&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;4000&apos;</span><span class="token punctuation">]</span>
</code></pre>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1542334978.png-atguiguText" alt=""></p>
<h3 id="2-&#x751F;&#x6210;16&#x8FDB;&#x5236;&#x5E8F;&#x5217;&#x9884;&#x5206;&#x533A;">2. &#x751F;&#x6210;16&#x8FDB;&#x5236;&#x5E8F;&#x5217;&#x9884;&#x5206;&#x533A;</h3>
<pre class="language-"><code class="lang-sql"><span class="token keyword">create</span> <span class="token string">&apos;staff2&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;info&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;partition2&apos;</span><span class="token punctuation">,</span>{NUMREGIONS <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token number">15</span><span class="token punctuation">,</span> SPLITALGO <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">&apos;HexStringSplit&apos;</span>}
</code></pre>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1542335305.png-atguiguText" alt=""></p>
<h3 id="3-&#x6309;&#x7167;&#x6587;&#x4EF6;&#x4E2D;&#x8BBE;&#x7F6E;&#x7684;&#x89C4;&#x5219;&#x9884;&#x5206;&#x533A;">3. &#x6309;&#x7167;&#x6587;&#x4EF6;&#x4E2D;&#x8BBE;&#x7F6E;&#x7684;&#x89C4;&#x5219;&#x9884;&#x5206;&#x533A;</h3>
<p>&#x521B;&#x5EFA;splits.txt&#x6587;&#x4EF6;&#x5185;&#x5BB9;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code>aaaa
bbbb
cccc
dddd
</code></pre><p>&#x7136;&#x540E;&#x6267;&#x884C;&#xFF1A;</p>
<pre class="language-"><code class="lang-sql"><span class="token keyword">create</span> <span class="token string">&apos;staff3&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;partition3&apos;</span><span class="token punctuation">,</span>SPLITS_FILE <span class="token operator">=</span><span class="token operator">&gt;</span> <span class="token string">&apos;splits.txt&apos;</span>
</code></pre>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1542335224.png-atguiguText" alt=""></p>
<h3 id="4-&#x4F7F;&#x7528;-javaapi-&#x521B;&#x5EFA;&#x9884;&#x5206;&#x533A;">4. &#x4F7F;&#x7528; JavaAPI &#x521B;&#x5EFA;&#x9884;&#x5206;&#x533A;</h3>
<pre class="language-"><code class="lang-java"><span class="token comment">//&#x81EA;&#x5B9A;&#x4E49;&#x7B97;&#x6CD5;&#xFF0C;&#x4EA7;&#x751F;&#x4E00;&#x7CFB;&#x5217;Hash&#x6563;&#x5217;&#x503C;&#x5B58;&#x50A8;&#x5728;&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x4E2D;</span>
<span class="token keyword">byte</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token punctuation">]</span> splitKeys <span class="token operator">=</span> &#x67D0;&#x4E2A;&#x6563;&#x5217;&#x503C;&#x51FD;&#x6570;
<span class="token comment">//&#x521B;&#x5EFA;HBaseAdmin&#x5B9E;&#x4F8B;</span>
HBaseAdmin hAdmin <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">HBaseAdmin</span><span class="token punctuation">(</span>HBaseConfiguration<span class="token punctuation">.</span><span class="token function">create</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//&#x521B;&#x5EFA;HTableDescriptor&#x5B9E;&#x4F8B;</span>
HTableDescriptor tableDesc <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">HTableDescriptor</span><span class="token punctuation">(</span>tableName<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//&#x901A;&#x8FC7;HTableDescriptor&#x5B9E;&#x4F8B;&#x548C;&#x6563;&#x5217;&#x503C;&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x521B;&#x5EFA;&#x5E26;&#x6709;&#x9884;&#x5206;&#x533A;&#x7684;HBase&#x8868;</span>
hAdmin<span class="token punctuation">.</span><span class="token function">createTable</span><span class="token punctuation">(</span>tableDesc<span class="token punctuation">,</span> splitKeys<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x4F8B;&#x5982;:</p>
<pre class="language-"><code class="lang-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">customSplitRegion</span><span class="token punctuation">(</span>String tableName<span class="token punctuation">,</span> String f1<span class="token punctuation">)</span> <span class="token keyword">throws</span> IOException <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token function">isTableExists</span><span class="token punctuation">(</span>tableName<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">return</span><span class="token punctuation">;</span>


    HTableDescriptor desc <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">HTableDescriptor</span><span class="token punctuation">(</span>TableName<span class="token punctuation">.</span><span class="token function">valueOf</span><span class="token punctuation">(</span>tableName<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    desc<span class="token punctuation">.</span><span class="token function">addFamily</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">HColumnDescriptor</span><span class="token punctuation">(</span>f1<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">byte</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token punctuation">]</span> keys <span class="token operator">=</span> <span class="token punctuation">{</span>
            Bytes<span class="token punctuation">.</span><span class="token function">toBytes</span><span class="token punctuation">(</span><span class="token string">&quot;aa&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
            Bytes<span class="token punctuation">.</span><span class="token function">toBytes</span><span class="token punctuation">(</span><span class="token string">&quot;bb&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
            Bytes<span class="token punctuation">.</span><span class="token function">toBytes</span><span class="token punctuation">(</span><span class="token string">&quot;cc&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
            Bytes<span class="token punctuation">.</span><span class="token function">toBytes</span><span class="token punctuation">(</span><span class="token string">&quot;dd&quot;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token punctuation">}</span><span class="token punctuation">;</span>
    admin<span class="token punctuation">.</span><span class="token function">createTable</span><span class="token punctuation">(</span>desc<span class="token punctuation">,</span> keys<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token punctuation">}</span>
</code></pre>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1542336176.png-atguiguText" alt=""></p>
<h2 id="&#x5728;&#x751F;&#x4EA7;&#x73AF;&#x5883;&#x4E2D;-&#x57FA;&#x672C;&#x90FD;&#x4F1A;&#x5BF9;&#x8868;&#x8FDB;&#x884C;&#x9884;&#x5206;&#x533A;">&#x5728;&#x751F;&#x4EA7;&#x73AF;&#x5883;&#x4E2D;, &#x57FA;&#x672C;&#x90FD;&#x4F1A;&#x5BF9;&#x8868;&#x8FDB;&#x884C;&#x9884;&#x5206;&#x533A;</h2>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x5C1A;&#x7845;&#x8C37;&#x5927;&#x6570;&#x636E; 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification"><br>&#x8BE5;&#x6587;&#x4EF6;&#x6700;&#x540E;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2018-12-23 21:35:03
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="91-gao-ke-yong.html" class="navigation navigation-prev " aria-label="Previous page: 9.1 高可用">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="93-rowkey-she-ji.html" class="navigation navigation-next " aria-label="Next page: 9.3 RowKey 设计">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"9.2 预分区","level":"1.9.2","depth":2,"next":{"title":"9.3 RowKey 设计","level":"1.9.3","depth":2,"path":"di-9-zhang-hbase-you-hua/93-rowkey-she-ji.md","ref":"di-9-zhang-hbase-you-hua/93-rowkey-she-ji.md","articles":[]},"previous":{"title":"9.1 高可用","level":"1.9.1","depth":2,"path":"di-9-zhang-hbase-you-hua/91-gao-ke-yong.md","ref":"di-9-zhang-hbase-you-hua/91-gao-ke-yong.md","articles":[]},"dir":"ltr"},"config":{"plugins":["splitter","expandable-chapters-small","page-toc-button","-highlight","prism","prism-themes","tbfed-pagefooter","sitemap","change_girls","livereload"],"styles":{"website":"styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 尚硅谷大数据 2019","modify_label":"<br>该文件最后修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prismjs/themes/prism-solarizedlight.css"]},"disqus":{"shortName":"zhenchao125"},"livereload":{},"splitter":{},"change_girls":{"time":30,"urls":["http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/62171757.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/83394736.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/15906185.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/15906185.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/3394270.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/65028582.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/20359261.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/37472401.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/3355397.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/11075549.jpg-atguiguImg"]},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"sitemap":{"hostname":"http://bigdataatguigu.applinzi.com/"},"page-toc-button":{"maxTocDepth":3,"minTocSize":2},"prism-themes":{},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":" 李振超","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"大数据 bigdata_hbase_atguigu 课堂笔记","language":"zh-hans","links":{"sidebar":{"联系我们":"http://www.atguigu.com/"}},"gitbook":"*","description":"课堂笔记,学生提前预习"},"file":{"path":"di-9-zhang-hbase-you-hua/92-yu-fen-qu.md","mtime":"2018-12-23T13:35:03.820Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-03-29T00:33:25.667Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-change_girls/girls.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

